#include <bits/stdc++.h>
// 2025/04/05
// tag:
// Author: Forever
using namespace std;
using int64 = int64_t;
#define int long long
#define dist(a, b) sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]))

class UF {
public:
    int parents[5001], cnt;

    UF(int n)
    {
        cnt = n;
        for (int i = 1; i <= n; i++)
            parents[i] = i;
    };

    int find(int i)
    {
        if (parents[i] != i)
            return parents[i] = find(parents[i]);
        return parents[i];
    }

    void un(int i, int j)
    {
        int ri = find(i), rj = find(j);
        if (ri == rj)
            return;
        parents[ri] = rj;
        cnt--;
    }

    int count()
    {
        return cnt;
    }

    bool connected(int p, int q)
    {
        return find(p) == find(q);
    }
};

class edge {
public:
    int u, v;
    double w;
    edge(int u, int v, double w)
        : u(u)
        , v(v)
        , w(w) { };
    edge()
        : u(0)
        , v(0)
        , w(0) { };
    bool operator<(const edge& e) const
    {
        return w < e.w;
    }
};

int n, m, x[1001], y[1001];
double ans;
edge edges[1000001];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    UF uf(n);
    for (int i = 1; i <= n; i++)
        cin >> x[i] >> y[i];
    int cnt = 0;
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
            edges[++cnt] = edge(i, j, dist(i, j));
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        uf.un(u, v);
    }
    sort(edges + 1, edges + cnt + 1);
    for (int i = 1; i <= cnt; i++) {
        if (uf.connected(edges[i].u, edges[i].v))
            continue;
        uf.un(edges[i].u, edges[i].v);
        ans += edges[i].w;
    }
    cout << fixed << setprecision(2) << ans << endl;
    return 0;
}